Jetfire Wiki
Jazz CMS
Debug
Jetfire Core
Jetfire Language
Jetfire Web Part
Library
Release Notes
Roles
States
Web Service
Workflow Administration
Quick Search
»
Advanced Search »
Back
States
Modified on 2010/12/10 18:37
by
John
Categorized as
States
===Overview=== Workflow classes can define a set of states allowing a [workflow|workflow object] to be in one given state. The workflow changes state by excuting 'enterstate' operator. Operations can be performed upon entering and leaving a state. Instance methods and properties can [Dynamic Access Modifier|dynamically] change to public or private as the state of the workflow object changes by [#usingstates|using the '' 'states'' ' construct]. {TOC} ===Defining a State=== A state is declared in Jetfire as method with no return type. For example: ((( {{public workflow MyFlow {BR} { {BR} : // declare a state called 'Start' {BR} : Start(){} {BR} } {BR}}} ))) ===Entering a State=== To enter a state the '' 'enterstate statename()'' ' operator needs to be used. Until the '' 'enterstate'' ' operator is excuted the workflow is in a null state. ((({{ public workflow MyFlow {BR} { {BR} :// 'Start' state{BR} :Start() {BR} :{ {BR} :: // place code to be executed when {BR} :: // the state is entered. {BR} :} {BR} :// constructor {BR} : public MyFlow() {BR} : { {BR} :: enterstate Start() {BR} :} {BR} } {BR} }}))) ===Using The 'states' Construct=== [anchor|#usingstates] Using the ''states'' construct the access modifier of a method or property can change dynamically as the state of the workflow changes. For example in the following code the method 'Submit' is public when the workflow is in the 'EnterData' state. When the workflow is no longer in the "EnterData" state the 'AddData' method access modifier is private. ((({{ {BR} :private ArrayList dataList = new ArrayList(); :// ://method 'AddData' has a dynamic access modifier :// :public void AddData(string data) :states(EnterData) {BR} :{ {BR} :: this.dataList.Add(data);{BR} :} {BR} }}))) {| border="1" ! State !! AddData |- | EnterData || public |- | any other state || private |} ===Examples=== * DVD Library * Request Approval ====DVD Library==== In this example each DVD in the library is represented by a workflow. The "Borrow" a DVD and "Return" a DVD methods are controlled by the 'states' construct. {BR} *[Jetfire Overview#DVD Library Example|DVD Library Example ] ====Request Approval==== This advanced example employs both states and roles in an request approval workflow. The 'state' of workflow ensures once a method is 'approved' that it can not be 'declined' at later date. The [role]s determine which users can 'approve' the request.{BR} *[http://www.codeplex.com/Jetfire/Wiki/View.aspx?title=Advanced%20Request%20Approval&referringTitle=C-Sharp%20Examples|Request Approval Example]
Meta Keywords:
Meta Description:
Change Comment:
ScrewTurn Wiki
version 3.0.4.560. Some of the icons created by
FamFamFam
.